package com.wxapp.common.core.filter.except;


import com.wxapp.common.constant.enums.ResultEnum;

/**
 * @author lgl
 * @Description
 * @Datetime 2022/12/13 15:18
 * @Modified By
 */
public class ThrowMyException extends Exception {
    private final int code;

    public ThrowMyException(ResultEnum resultEnum) {
        super(resultEnum.getDesc());
        this.code = resultEnum.getValue();
    }

    public ThrowMyException(String msg) {
        super(msg);
        this.code = ResultEnum.FORBIDDEN.getValue();
    }

    public ThrowMyException() {
        super(ResultEnum.FORBIDDEN.getDesc());
        this.code = ResultEnum.FORBIDDEN.getValue();
    }

    protected ThrowMyException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, int code) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = code;
    }

    public int getCode() {
        return code;
    }
}
